(function(){
	/**
	 * 帧工具
	 */
	class FrameUtil {
		constructor(){
			//当前帧序号
			this.currentFrame = 0;

			//帧率的起始时间
			this.sTime = new Date();

			//起始帧，用于统计fps
			this.sFrame = 0;

			//真实的fps
			this.realFps = 0;

		}

		update(){
			//每N毫秒+1
			this.currentFrame++;

			var t = new Date();

			if(t - this.sTime >= 1000){
				this.realFps = this.currentFrame - this.sFrame;
				this.sTime = t;
				this.sFrame = this.currentFrame;
			}
		}
	}

	window.FrameUtil = FrameUtil;
})();
